import config from '@/config/app.config.js'
// ES
import * as RongIMLib from '@rongcloud/imlib-next'
import RongIMEmoji from '@/utils/RongIMEmoji-2.2.6.js'


// 应用初始化以获取 RongIMLib 实例对象，请务必保证此过程只被执行一次
RongIMLib.init({ appkey: config.RongIMAppKey, logOutputLevel:4});
RongIMLib.RongIMEmoji = RongIMEmoji

// 融云表情包初始化
const emojiConfig = {
  size: 38,
  lang: 'en'
}
RongIMLib.RongIMEmoji.init(emojiConfig)


/**
 * 自定义信息
 * messageType	string	消息类型
 * isPersited	boolean	是否存储
 * isCounted	boolean	是否计数
 * searchProps	string[]	搜索字段，web 端无需设置，搜索字段值设置为数字时取值范围为 (-Math.pow(2, 64), Math.pow(2, 64)) 且为整数
 * isStatusMessage	boolean	是否是状态消息。状态消息不存储、不计数，接收方在线时才能收到。
 *
 */

// 引用信息
const RecallMessage = RongIMLib.registerMessageType('OL:Recall', true, true, [], false)
RongIMLib.RecallMessage = RecallMessage

// 名片信息
const CardMessage = RongIMLib.registerMessageType('OL:Card', true, true, [], false)
RongIMLib.CardMessage = CardMessage

// 设置已读到的时间戳
const ReadStatusMessage = RongIMLib.registerMessageType('OL:ReadStatus', true, false, [], false)
RongIMLib.ReadStatusMessage = ReadStatusMessage

// 预渲染信息
const PreRenderMessage = RongIMLib.registerMessageType('OL:Prerender', true, false, [], false)
RongIMLib.PreRenderMessage = PreRenderMessage

// 客服工单
const WorkTicketsMessage = RongIMLib.registerMessageType('OL:WorkTickets', true, false, [], false)
RongIMLib.WorkTicketsMessage = WorkTicketsMessage

export default RongIMLib
